package p2pmodule;

import java.net.InetAddress;

/**
 * This class represents an item of a P2P network.
 * 
 * @author ole
 */
public class Item {
	private int port;
	private int size;
	private InetAddress ip;
	private String name;
	
	/**
	 * Constructor class.
	 * 
	 * @param name:
	 * 		The name of the file this item represents.
	 * @param size:
	 * 		The size in bytes of this item.
	 * @param ip:
	 * 		The IP where the item can be found.
	 * @param port:
	 * 		The port where the file server is listening in the IP address.
	 */
	public Item(String name, int size, InetAddress ip, int port) {
		this.name = name;
		this.size = size;
		this.ip = ip;
		this.port = port;
	}
	
	/**
	 * Returns the IP address where the item can be found.
	 */
	public InetAddress getIp() {
		return ip;
	}
	
	/**
	 * Returns the name of the item.
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Returns the port where the server capable of serving the item is
	 * listening in the IP address also maintained by this item.
	 */
	public int getPort() {
		return port;
	}
	
	/**
	 * The total size in bytes of the item.
	 */
	public int getSize() {
		return size;
	}
}
